package cn.kgc.ffzw.day16;

public class Penguin {
    private String name;
    private int health;
    private int love;
    private String sex;

    public Penguin(){}

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getHealth() {
        return health;
    }

    public void setHealth(int health) {
        if (health > 100||health<0) {
            System.out.println("您的输入不正确，健康值默认为60");
            this.health=60;
        }else {
            this.health = health;
        }
    }

    public int getLove() {
        return love;
    }

    public void setLove(int love) {
        if (love > 100||love<0) {
            System.out.println("您的输入不正确，亲密度默认为60");
            this.love=60;
        }else {
            this.love = love;
        }
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        if (sex.equals("雌")||sex.equals("雄")) {
            this.sex = sex;
        }else {
            this.sex = "雄";

        }
    }

    public Penguin(String name, int health, int love, String sex) {
        this.setName(name);
        this.setHealth(health);
        this.setLove(love);
        this.setSex(sex);
    }
    public  void show(){
        System.out.println(name+"\t"+health+"\t"+love+"\t"+sex);
    }
}
